package com.burial.controller;


import com.burial.common.result.Result;
import com.burial.dto.OrderDTO;
import com.burial.service.OrderInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 订单详情信息表 前端控制器
 * </p>
 *
 * @author burial
 * @since 2024-04-18
 */
@RestController
@Api(tags = "订单详情接口")
@RequestMapping("/order-info")
public class OrderInfoController {

    @Autowired
    private OrderInfoService orderInfoService;

    @GetMapping("/{oid}")
    @ApiOperation("查询订单详情")
    public Result findOrderInfoById(@PathVariable("oid")Integer oid){
        if (oid==null){
            return Result.error("输入错误");
        }
        OrderDTO orderInfo = orderInfoService.findOrderInfo(oid);
        if (orderInfo==null){
            return Result.error("查询错误");
        }
        return Result.success(orderInfo);
    }

}

